package com.suitsoft.ut.service.select;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springside.modules.orm.Page;

import com.suitsoft.ut.commons.UserHolder;
import com.suitsoft.ut.dao.account.UserDao;
import com.suitsoft.ut.dao.thesis.ThesisDao;
import com.suitsoft.ut.entity.account.User;
import com.suitsoft.ut.entity.base.Student;
import com.suitsoft.ut.entity.base.Teacher;
import com.suitsoft.ut.entity.thesis.Thesis;

/**
 * 选题 服务层类
 *@author Suineg
 */
@Service
@Transactional
public class SelectManager {
	/** 日志输出对象 */
	protected final Logger logger = LoggerFactory.getLogger(getClass());
	@Autowired
	private ThesisDao dao;
	@Autowired
	private UserDao userDao;
	
	public void findBySelectTeacher(Page<Thesis> page,String titile,String teacherName,Long flag,Long status,Teacher teacher){
		dao.findBySelect(page, flag, status,teacherName, titile,teacher);
	}
	public void findBySelectTeacher(Page<Thesis> page,String titile,String teacherName,Long flag,List<Long> status,Teacher teacher){
		dao.findBySelectTeacher(page, flag, status,teacherName, titile,teacher);
	}
	public void findBySelectStudent(Page<Thesis> page,String titile,String teacherName,Long flag,Long status,Student student){
		dao.findBySelect(page, flag, status,teacherName, titile,student);
	}
	
	public void findBySelect(Page<Thesis> page,String titile,String teacherName,Long flag,List<Long> status){
		dao.findBySelect(page, flag, status,teacherName, titile );
	}
	
	public void findBySelect(Page<Thesis> page,String titile,String teacherName,Long flag,List<Long> status,Student student){
		dao.findBySelect(page, flag, status,teacherName, titile ,student);
	}
	
	public void findBySelect(Page<Thesis> page,String titile,String teacherName,Long flag,List<Long> status,Teacher teacher){
		dao.findBySelect(page, flag, status,teacherName, titile ,teacher);
	}
	
	public List<Thesis> findAllBySelect(Page<Thesis> page,String titile,String teacherName,Long flag,List<Long> status){
		return dao.findAllBySelect(page, flag, status, titile, teacherName);
	}
	
	public void findBySelect(Page<Thesis> page,String titile,String teacherName,List<Long> flag,List<Long> status){
		dao.findBySelect(page, flag, status, titile, teacherName);
	}

	public List<Thesis> findExaminationBy(Page<Thesis> page,String titile,String teacherName,Long flag,Long status,Long isStudentExamination,Long isTeacherExamination,Teacher teacher){
		return dao.findExaminationBy(page, flag, status, teacherName, titile, isStudentExamination, isTeacherExamination,teacher);
	}
	public List<Thesis> findExaminationBy(Page<Thesis> page,String titile,String teacherName,List<Long> flag,List<Long> status,Long isStudentExamination,Long isTeacherExamination){
		return dao.findExaminationBy(page, flag, status, teacherName, titile, isStudentExamination, isTeacherExamination);
	}
	/**
	 * 搜索已被选中的论文 
	 * @return
	 */
	public List<Thesis> findSelcted(){
		return dao.findSelcted();
	}
	
	/**
	 * 搜索已被选中的且是中期的
	 * @return
	 */
	public List<Thesis> findSelectedForMiddle(){
		User user = userDao.get(UserHolder.getLoginUser().getId());
		Teacher teacher = user.getTeacher();
		return dao.findSelectedForMidlle(teacher);
	}
	
	public List<Thesis> findSelectedForMiddleByUser(String userCollegeCode){
		return dao.findSelectedForMidlle(userCollegeCode);
	}
	
	public Page<Thesis> findOld(Page<Thesis> page,String year,String teacherName,String stduentName,String studentNo,Long flag,Long stauts){
		return dao.findOld(page, year, teacherName, stduentName, studentNo, flag, stauts);
	}
}

